from numpy import array
import pylab as pl

x = array([8, 15])
P1 = array([11.810, 46.602])
P2 = array([9.283, 178.800])
P3 = array([10.155, 198.170])
P4 = array([9.390,155.755])

pl.semilogy(x, P1, "ro")
pl.semilogy(x, P2, "ro")
pl.semilogy(x, P3, "ro")
pl.semilogy(x, P4, "ro")
pl.semilogy(x, (P1+P2+P3+P4)/4, "r-", label="Powell")

x = array([8, 15, 41])

C1 = array([0.484, 3.739, 686.862])
C2 = array([0.843, 6.042,419.158])
C3 = array([0.433, 4.992,197.305])
C4 = array([0.536,3.805,174.029])

B1 = array([0.245, 1.4, 83.095])
B2 = array([0.397, 2.632, 126.628])
B3 = array([0.319, 3.590, 194.697])
B4 = array([0.330,2.489, 154.286])


pl.semilogy(x, C1, "gs")
pl.semilogy(x, C2, "gs")
pl.semilogy(x, C3, "gs")
pl.semilogy(x, C4, "gs")
pl.semilogy(x, (C1+C2+C3+C4)/4, "g-", label="Conjugate Gradient")


pl.semilogy(x, B1, "bD")
pl.semilogy(x, B2, "bD")
pl.semilogy(x, B3, "bD")
pl.semilogy(x, B4, "bD")
pl.semilogy(x, (B1+B2+B3+B4)/4, "b-", label="BFGS")

pl.legend(loc=0)
pl.xlabel("Number of Atoms")
pl.ylabel("Time (s)")
pl.savefig('optimize.png')

